Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

752
Visualizações
php artisan migrate - SQLSTATE[HY000] [1045] Access denied for user 'laravel'@'localhost'

I want to set up and learn Laravel following this course

When I try to use the command php artisan migrate I get this error:

[Illuminate\Database\QueryException]                                                                                                        
  SQLSTATE[HY000] [1045] Access denied for user 'laravel'@'localhost' (using password: NO) (SQL: select * from information_schema.tables whe  
  re table_schema = laravel and table_name = migrations)

[PDOException]                                                                            
  SQLSTATE[HY000] [1045] Access denied for user 'laravel'@'localhost' (using password: NO)

I have looked for answers. I figured I may have to make some changes in the .env file, but I don't know what, and nothing I have tried so far has worked.

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=laravel
DB_PASSWORD=

I'm using Ubuntu 16.04, not a Mac OS X as in the video, so I wonder what should I do differently? Is there some MySQL setting I did not set correctly?

over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

I had the same problem with my plesk ubuntu 18.04 remote server. In your .env file put double quotes around your database password and username then run php artisan config:clear and php artisan cache:clear

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=dbname
DB_USERNAME="xyz"    
DB_PASSWORD="123"

I had never come across this problem before.

over 4 years ago · Santiago Trujillo Relatório

0

You don't have a user named 'laravel'. You should change the DB_USERNAME to the one you're actually using to access your DB. Mostly it's root by default so the changes in .env should be

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=
over 4 years ago · Santiago Trujillo Relatório

0

If you are trying to run this command with homestead, you need to make sure you change the values of the following environmental variables within the .env file to:

DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret

After you have changed the values, make sure to run the following two commands before you do anything else:

php artisan config:clear
php artisan cache:clear
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda